package wqh.global;


import java.util.ArrayList;
import java.util.List;

public class GlobalDevice {

    private static final List<String> ipList = new ArrayList<String>();

    public static synchronized void addIp(String ip)
    {
        ipList.add(ip);
    }

    public static synchronized void removeIp(String ip)
    {
        for(String _ip : ipList)
        {
            if(_ip.equals(ip))
            {
                ipList.remove(ip);
                break;
            }
        }
    }

    public static synchronized boolean exist(String ip)
    {
        for(String _ip : ipList)
        {
            if(_ip.equals(ip))
            {
                return true;
            }
        }
        return false;
    }

    public static synchronized List<String> getIpList() {
        return ipList;
    }

}
